package game;

import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;

import javax.imageio.ImageIO;

public class GameUtil {
	//工具类最好将构造器私有化
	private void GameUtil() {
		
	}
	/**
	 * 返回指定路径文件
	 * @param path
	 * @return
	 */
	public static Image getImage(String path) {
		BufferedImage b = null;
		try {
			URL u = GameUtil.class.getClassLoader().getResource(path);
			b = ImageIO.read(u);
			//System.out.println(b.toString());
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
		return b;
	}
}
